function aiEstimatedClasses =			...
			ClassifyEvents(				...
				atEvents,				...
				atSVMs					)
	%
	global bPrintDebugInformation;
	global tFileID;
	%
	% for readability
	iNumberOfEvents		= numel(atEvents);
	iNumberOfClasses	= PeopleCounters.GetNumberOfClasses();
	%
	% if there are no events then return
	if( iNumberOfEvents <= 0 )
		%
		aiEstimatedClasses = [];
		return;
		%
	end;%
	%
	% initialization
	iNumberOfFeatures	= numel( atEvents(1).afFeatures );
	aafFeatures			= zeros( iNumberOfEvents, iNumberOfFeatures );
	aiEstimatedClasses	= zeros( iNumberOfEvents, 1 );
	%
	% summarize the features in a single matrix
	for iEvent = 1:iNumberOfEvents;
		%
		aafFeatures(iEvent, :) = atEvents(iEvent).afFeatures;
		%
	end;%
	%
	% allocate the storage to save the probabilities of the estimates
	aafProbabilitiesOfEstimates = zeros( iNumberOfEvents, iNumberOfClasses );
	%
	% do the one against all classification
	for iCurrentClass = 1:iNumberOfClasses
		%
		% do the estimation step for the current class only if the class was trained
		if( numel(atSVMs{iCurrentClass}) > 0 )
			%
			[	aiCurrentEstimatedClasses,								...
				fCurrentAccuracy,										...
				aafCurrentProbabilitiesOfEstimates	] =					...
					svmpredict(											...
						double( aiEstimatedClasses == iCurrentClass ),	... fake
						aafFeatures,									...
						atSVMs{iCurrentClass}, '-q -b 1'				);
			%
			% select that probabilities corresponding to the currently estimated class
			aafProbabilitiesOfEstimates(:, iCurrentClass) =	...
				aafCurrentProbabilitiesOfEstimates(:, atSVMs{iCurrentClass}.Label == 1);
			%
		else%
			%
			% in this case the probability of estimates is null, because the class wasn't trained
			aafProbabilitiesOfEstimates(:, iCurrentClass) =	0;
			%
		end;%
		%
		if( bPrintDebugInformation )
			%
			fprintf(tFileID, 'Testing class: %d\n', iCurrentClass);
			%
		end;%
		%
	end;% cycle on the various classes for the one against all classification
	%
	% select as the estimate that one for which the probability is the highest
	[ afMaximalProbabilities, aiEstimatedClasses ] = max( aafProbabilitiesOfEstimates, [], 2 );
	%
	% remove the invalid data and store the estimated class into the events
	for iEvent = 1:iNumberOfEvents;
		%
		if( ~atEvents(iEvent).bIsValid )
			%
			aiEstimatedClasses(iEvent) = 999;
			%
		end;%
		%
		atEvents(iEvent).iResultingEstimatedClass	= aiEstimatedClasses(iEvent);
		atEvents(iEvent).strEstimatedClass			= PeopleCounters.ConvertIntegerCodeIntoClassString(aiEstimatedClasses(iEvent));
		%
		if( bPrintDebugInformation )
			%
			fprintf(tFileID, 'Event %d has been classified with class %s\n', iEvent, atEvents(iEvent).strEstimatedClass);
			atEvents(iEvent).Plot();
			%
		end;%
		%
	end;%
	%
end % function

